<h1><?php echo $this->lang->line('title'); ?></h1>
<hr />
<ul class="nav nav-tabs">
    <?php if (isset($data['idUser'])) { ?>
    <li><a href="<?php echo admin_url('users/changepwd/' . $data['idUser'] ); ?>" class="btn"><?php echo $this->lang->line('ChangePwd'); ?></a></li>
    <?php } ?>
    <li class="active"><a href="<?php echo admin_url('users/add'); ?>"><?php echo $this->lang->line('Add user'); ?></a></li>
</ul>
<?php echo form_open_multipart($action, array('class' => 'form-horizontal well')); ?>
<?php echo form_fieldset($head_title); ?>
<?php if (isset($error) && !empty($error)) { ?>
    <div class="error"><?php echo $error; ?></div>
<?php } ?>

<?php if (isset($form['username'])) { ?>
    <?php echo form_error('username'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Username') ?> *</label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_input($form['username']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['password'])) { ?>
    <?php echo form_error('password'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Password') ?> *</label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_password($form['password']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['password_confirm'])) { ?>
    <?php echo form_error('password_confirm'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('PasswordConfirm') ?> *</label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_password($form['password_confirm']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['first_name'])) { ?>
    <?php echo form_error('first_name'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Firstname') ?></label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_input($form['first_name']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['last_name'])) { ?>
    <?php echo form_error('last_name'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Lastname') ?></label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_input($form['last_name']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['email'])) { ?>
    <?php echo form_error('email'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Email') ?> *</label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_input($form['email']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['current_avatar']['value']) && !empty($form['current_avatar']['value'])) { ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('CurrentAvatar') ?></label>
        <div class="controls">
            <div class="input-prepend">
                <img src="<?php echo admin_url('common/image_avatar/' . $form['current_avatar']['value']); ?>" />
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['avatar'])) { ?>
    <?php echo form_error('avatar'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Avatar') ?></label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_upload($form['avatar']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['role_id'])) { ?>
    <?php echo form_error('role_id'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Role') ?> *</label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_dropdown($form['role_id']['name'], $form['role_id']['options'], $form['role_id']['selected']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php if (isset($form['status'])) { ?>
    <?php echo form_error('status'); ?>
    <div class="control-group">
        <label class="control-label"><?php echo $this->lang->line('Status') ?></label>
        <div class="controls">
            <div class="input-prepend">
                <?php echo form_dropdown($form['status']['name'], $form['status']['options'], $form['status']['selected']) ?>
            </div>
        </div>
    </div>
<?php } ?>

<?php echo form_fieldset_close(); ?>
<div class="form-actions">
    <?php echo form_submit($form['submit']) ?>
</div>
<?php echo form_close() ?>